{include file="common/head"/}
<style>
    .catMin{background: #f5f5f5;padding: 5px 10px;}
    .catMin a:hover{color: #f8938e
    }
    .catMin h3{
        line-height:30px;
        font-size:18px;}
</style>
<div class="admin-main layui-anim layui-anim-upbit">
    <form class="layui-form ">
        <div class="layui-form-item">
             <input type="text" name="search" id="Search" value="{$testkey}"  placeholder="请输入搜索内容..." autocomplete="off" class="layui-input">
        </div>
        <div class="catMin">
            {$actList}
        </div>
    </form>
</div>
{include file="common/foot"/}
<script>
    layui.use(['form', 'layer','upload'], function () {
        var form = layui.form, $ = layui.jquery, upload = layui.upload;
        form.on('submit(submit)', function (data) {
            // 提交到方法 默认为本身
            data.field.ad_id = $scope.field.ad_id;
            var loading = layer.load(1, {shade: [0.1, '#fff']});
            $.post("", data.field, function (res) {
                layer.close(loading);
                if (res.code > 0) {
                    layer.msg(res.msg, {time: 1800, icon: 1}, function () {
                        location.href = res.url;
                    });
                } else {
                    layer.msg(res.msg, {time: 1800, icon: 2});
                }
            });
        });


        //搜索操作
        $('#Search').keyup(function(){
            console.log($(this).val());
            var key = $(this).val();
            $.post('{:url(getCat)}',{key:key},function(v){
                $('.catMin').html('');
                $('.catMin').html(v);
            })
        });


        $(".catMin").on("click",'a',function(){
            var cid = $(this).attr('data-id');
            var name = $(this).attr('data-name');

            window.parent.document.getElementById("getCat").value = name;
            window.parent.document.getElementById("getCatid").value = cid;

            //关闭当前窗口
            var index = parent.layer.getFrameIndex(window.name);
            parent.layer.close(index);

        });
    });
</script>